Skip to contentSkip to conversation

Change in openvpn[master]: ssl_mbedtls: Fix format string in get_ssl_library_version

Openvpn-devel In review flichtenheld (Code Review) 2 participants 6 messages Apr 13 – Apr 14 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1776081318000.I232fba91cfcca6c35d37696bc86890a366f5967f@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1626?usp=email

to review the following change.

Change subject: ssl_mbedtls: Fix format string in get_ssl_library_version
......................................................................

ssl_mbedtls: Fix format string in get_ssl_library_version

These are unsigned values, so treat them as such.

Identified by cppcheck.

Change-Id I232fba91cfcca6c35d37696bc86890a366f5967f

---
M src/openvpn/ssl_mbedtls.c

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/26/1626/1

src/openvpn/ssl_mbedtls.c +1 -1
index a62ff76..85c771a 100644
@@ -1572,7 +1572,7 @@
 {
     static char mbedtls_version[30];
     unsigned int pv = mbedtls_version_get_number();
-    snprintf(mbedtls_version, sizeof(mbedtls_version), "mbed TLS %d.%d.%d", (pv >> 24) & 0xff,
+    snprintf(mbedtls_version, sizeof(mbedtls_version), "mbed TLS %u.%u.%u", (pv >> 24) & 0xff,
              (pv >> 16) & 0xff, (pv >> 8) & 0xff);
     return mbedtls_version;
 }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1626?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I232fba91cfcca6c35d37696bc86890a366f5967f
Gerrit-Change-Number: 1626
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld.

plaisthos has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1626?usp=email )

Change subject: ssl_mbedtls: Fix format string in get_ssl_library_version
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1626?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I232fba91cfcca6c35d37696bc86890a366f5967f
Gerrit-Change-Number: 1626
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 13 Apr 2026 21:35:25 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH 1/1 ssl_mbedtls: Fix format string in get_ssl_library_version

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

These are unsigned values, so treat them as such.

Identified by cppcheck.

Change-Id I232fba91cfcca6c35d37696bc86890a366f5967f

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1626
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1626
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Arne Schwabe <[email protected]...>

src/openvpn/ssl_mbedtls.c +1 -1
index a62ff76..85c771a 100644
@@ -1572,7 +1572,7 @@
 {
     static char mbedtls_version[30];
     unsigned int pv = mbedtls_version_get_number();
-    snprintf(mbedtls_version, sizeof(mbedtls_version), "mbed TLS %d.%d.%d", (pv >> 24) & 0xff,
+    snprintf(mbedtls_version, sizeof(mbedtls_version), "mbed TLS %u.%u.%u", (pv >> 24) & 0xff,
              (pv >> 16) & 0xff, (pv >> 8) & 0xff);
     return mbedtls_version;
 }
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: ssl_mbedtls: Fix format string in get_ssl_library_version

Good find. With the expected version numbers in mbedTLS, we're unlikely to hit an actual sign/unsign overflow ("3.5.128" maybe?), so I don't think this needs to go to 2.7.

Your patch has been applied to the master branch.

commit 9a6e3646610afb13c794f284b25222dac19f095a

Author: Frank Lichtenheld
Date:   Tue Apr 14 07:59:21 2026 +0200
     ssl_mbedtls: Fix format string in get_ssl_library_version

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1626
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg36607.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1626?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by plaisthos

Change subject: ssl_mbedtls: Fix format string in get_ssl_library_version
......................................................................

ssl_mbedtls: Fix format string in get_ssl_library_version

These are unsigned values, so treat them as such.

Identified by cppcheck.

Change-Id I232fba91cfcca6c35d37696bc86890a366f5967f

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1626
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg36607.html

---
M src/openvpn/ssl_mbedtls.c

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/26/1626/2

src/openvpn/ssl_mbedtls.c +1 -1
index a62ff76..85c771a 100644
@@ -1572,7 +1572,7 @@
 {
     static char mbedtls_version[30];
     unsigned int pv = mbedtls_version_get_number();
-    snprintf(mbedtls_version, sizeof(mbedtls_version), "mbed TLS %d.%d.%d", (pv >> 24) & 0xff,
+    snprintf(mbedtls_version, sizeof(mbedtls_version), "mbed TLS %u.%u.%u", (pv >> 24) & 0xff,
              (pv >> 16) & 0xff, (pv >> 8) & 0xff);
     return mbedtls_version;
 }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1626?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I232fba91cfcca6c35d37696bc86890a366f5967f
Gerrit-Change-Number: 1626
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1626?usp=email )

Change subject: ssl_mbedtls: Fix format string in get_ssl_library_version
......................................................................

ssl_mbedtls: Fix format string in get_ssl_library_version

These are unsigned values, so treat them as such.

Identified by cppcheck.

Change-Id I232fba91cfcca6c35d37696bc86890a366f5967f

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1626
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg36607.html

---
M src/openvpn/ssl_mbedtls.c

1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/ssl_mbedtls.c +1 -1
index a62ff76..85c771a 100644
@@ -1572,7 +1572,7 @@
 {
     static char mbedtls_version[30];
     unsigned int pv = mbedtls_version_get_number();
-    snprintf(mbedtls_version, sizeof(mbedtls_version), "mbed TLS %d.%d.%d", (pv >> 24) & 0xff,
+    snprintf(mbedtls_version, sizeof(mbedtls_version), "mbed TLS %u.%u.%u", (pv >> 24) & 0xff,
              (pv >> 16) & 0xff, (pv >> 8) & 0xff);
     return mbedtls_version;
 }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1626?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I232fba91cfcca6c35d37696bc86890a366f5967f
Gerrit-Change-Number: 1626
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>